﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ForumDomainModels.Mappers
{
    public class UserMapper
    {
        public ForumDomainModels.User DataFromDatabaseToUserDomainModel(SqlDataReader reader)
        {
            ForumDomainModels.User userModel = new ForumDomainModels.User();
            userModel.Id = (int)reader["Id"];
            userModel.Username = (string)reader["Username"];
            userModel.Password = (string)reader["Password"];
            userModel.FirstName = (string)reader["FirstName"];
            userModel.LastName = (string)reader["LastName"];
            userModel.Age = (int)reader["Age"];
            userModel.IsAdmin = (bool)reader["IsAdmin"];
            userModel.DateRegistered = (DateTime)reader["DateRegistered"];
            return userModel;
        }
    }
}
